using System;
using System.Collections.Generic;
using System.Text;

namespace SBPweb.Forge.Modules.Modularity
{
	/// <summary>
	/// Class of ModuleInfo
	/// </summary>
	public class ModuleInfo
	{

		#region Private members

		private ModuleDescriptor moduleDescriptor;
		private IModule module;
		private bool isAutoLoad;
		private bool isAllowUnload;
		private bool isCoreModule;

		#endregion

		#region Constructor logic

		/// <summary>
		/// Initializes a new ModuleInfo instance
		/// </summary>
		/// <param name="md">The referenced module descriptor instance</param>
		/// <param name="autoLoad">Parameter for autoLoad</param>
		/// <param name="allowUnload">Parameter for allowUnload</param>
		/// <param name="isCoreModule">Parameter is true if module is core module</param>
		public ModuleInfo(ModuleDescriptor md, bool autoLoad, bool allowUnload, bool isCoreModule)
		{
			this.moduleDescriptor = md;
            this.module = null;
            this.isAutoLoad = autoLoad;
            this.isAllowUnload = allowUnload;
            this.isCoreModule = isCoreModule;
		}

		#endregion

		#region Public properties

		/// <summary>
		/// This propterty returns the referenced module descriptor
		/// </summary>
		public ModuleDescriptor ModuleDescriptor
		{
			get
			{
				return moduleDescriptor;
			}
		}

		/// <summary>
		/// This property returns the referenced module instance
		/// </summary>
		public IModule Module
		{
			get
			{
				return module;
			}
			set
			{
				module = value;
			}
		}

		/// <summary>
		/// This property is false if module supports post loading
		/// </summary>
		public bool AutoLoad
		{
			get
			{
				return isAutoLoad;
			}
		}

		/// <summary>
		/// This property is true if module supports runtime unloading
		/// </summary>
		public bool AllowUnload
		{
			get
			{
				return isAllowUnload;
			}
		}

		/// <summary>
		/// Returns true is module is core module
		/// </summary>
		public bool IsCoreModule
		{
			get
			{
				return isCoreModule;
			}
		}

		#endregion

	}
}
